import configparser
import os.path

"""
从配置文件中读取配置项
"""
class Reader:
    @classmethod
    def getConfig(self,section:str,key=None)->str:
        config = configparser.ConfigParser()
        dir = os.path.dirname(os.path.dirname(__file__))
        file_path =os.path.join(dir , 'config','config.ini')
        config.read(filenames=file_path,encoding='utf-8')
        if key != None:
            return config.get(section,key)
        else:
            return config.items(section)
